<cfcomponent output="false" extends="designPattern.composite.Component">
	
	<cfset this.child = arrayNew(1) />
	
	<cffunction name="init" access="public" output="false" returntype="Component">
		<cfargument name="name" type="string" required="true" />
		<cfset super.init( arguments.name ) />
		<cfreturn this />
	</cffunction>
	
	<cffunction name="add" access="public" output="false" returntype="void">
		<cfargument name="component" type="Component" required="true" />
		<cfset arrayAppend( this.child , arguments.component ) />
	</cffunction>
	
	<cffunction name="remove" access="public" output="false" returntype="void">
		<cfargument name="component" type="Component" required="true" />
		<cfset var pos = 0 />
		<cfset var com = arguments.component.name />
		
		<cfloop index="i" from="1" to="#arrayLen( this.child )#">
			<cfif com EQ this.child[i].describe() >
				<cfset arrayDeleteAt( this.child, i ) />
			</cfif>
		</cfloop>
	</cffunction>
	
	<cffunction name="getChild" access="public" output="false" returntype="Component">
		<cfargument name="index" type="numeric" required="true" />
		<cfreturn this.child[arguments.index] />
	</cffunction>
	
	<cffunction name="describe" access="public" output="false" returntype="void">
		<cfset var i = "" />
		<cftrace type="information" text="Component: #this.name# Composed by{" />
		<cfloop array="#this.child#" index="i">
			<cftrace type="information" text="Component: #i.name#" />
		</cfloop>
		<cftrace type="information" text="}" />
	</cffunction>

</cfcomponent>